home *** CD-ROM | disk | FTP | other *** search
- Path: solon.com!not-for-mail
- From: ksexton@wilde.oit.umass.edu (Kevin M Sexton)
- Newsgroups: comp.lang.c,comp.lang.c.moderated,comp.os.ms-windows.programmer.misc
- Subject: Re: Text representation of a number...
- Followup-To: comp.lang.c,comp.lang.c.moderated,comp.os.ms-windows.programmer.misc
- Date: 14 Feb 1996 21:14:28 -0600
- Organization: University of Massachusetts, Amherst
- Sender: clc@solutions.solon.com
- Approved: clc@solutions.solon.com
- Message-ID: <4fu8ek$9lp@solutions.solon.com>
- References: <4fjm7r$odb@solutions.solon.com>
- NNTP-Posting-Host: solutions.solon.com
- X-Newsreader: TIN [version 1.2 PL2]
-
- Joel York (yorkjoe@elof.acc.iit.edu) wrote:
-
-
- : Greetings.
- : I'm in need of an algorithm to take an eight-byte integer (not supported
- : as a native type in Windows 3.1), and print its ASCII representation
- : to a file. This number comes from a server that stores the number in
- : big-endian format, but I could switch it if necessary. If anyone
- : knows such an algorithm, or has a pointer to one, it'd be much
- : appreciated.
- : TIA
- : Joel
- I hope this helps. I'm unsure of how you are holding the eight-byte
- integer inside of the program. I would imagine you are using something
- along the lines of an unsigned long for the lower bits and a signed long
- for the higher bits. As for an ASCII representation of this number, I
- would suggest using some bit shifting to accomplish this. (This
- conversion might be easier if done in hex rather than decimal.) You
- would have to consecutively mask off the last four bits, convert this to
- its hex equivalent, and then shift off these four bits and repeat.
-
- Kevin
-